package cn.mst.vrs.handler;

import cn.dev33.satoken.exception.NotLoginException;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

import static cn.iocoder.yudao.framework.common.exception.enums.GlobalErrorCodeConstants.UNAUTHORIZED;

@Slf4j
@RestControllerAdvice
public class VrsGlobalExceptionHandler {
    @ExceptionHandler(NotLoginException.class)
    public CommonResult<?> notLoginExceptionHandler(NotLoginException ex){
        log.warn("[notLoginExceptionHandler]", ex);
        return CommonResult.error(UNAUTHORIZED);
    }
}
